<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>深圳在线预约诊疗服务平台</title>
    <link rel="stylesheet" href="public/css/lib/bootstrap.min.css" tppabs="https://guahao.zjol.com.cn/public/css/lib/bootstrap.min.css">
    <link rel="stylesheet" href="public/css/lib/glider.min.css" tppabs="https://guahao.zjol.com.cn/public/css/lib/glider.min.css">
    <link rel="stylesheet" href="public/css/lib/bootstrap-datepicker.min.css" tppabs="https://guahao.zjol.com.cn/public/css/lib/bootstrap-datepicker.min.css">
    <link rel="stylesheet" href="public/css/lib/jquery-confirm.min.css" tppabs="https://guahao.zjol.com.cn/public/css/lib/jquery-confirm.min.css">


    <!-- <link rel="stylesheet" href="/public/css/lib/material-icons.css">
    <link rel="stylesheet" href="/public/css/lib/bootstrap-material-design.min.css" > -->

    <link rel="stylesheet" href="public/css/global.css" tppabs="https://guahao.zjol.com.cn/public/css/global.css">


    <link rel="stylesheet" href="public/css/login.css" tppabs="https://guahao.zjol.com.cn/public/css/login.css">

</head>

<body>

<div class="login-box">
    <div class="login-container clearfix">
        <div class="login-left float-left">

        </div>
        <div class="login-right float-left">
            <div class="login-title">
                <span class="active">医生登录</span>
                <a href="login.html" tppabs="https://guahao.zjol.com.cn/register" style="color: #2f2f2f;">用户登录</a>
            </div>
            <div class="login-content">
                <div class="login-item">
                    <div class="login-item-name">账号</div>
                    <div class="login-item-ipt">
                        <input type="text" class="form-control username-ipt" id="username" placeholder="请输入账号">
                    </div>
                </div>
                <div class="login-item">
                    <div class="login-item-name">密码</div>
                    <div class="login-item-ipt">
                        <input class="form-control password-ipt" id="password" placeholder="请输入密码" type="password">
                        <input type="hidden" value="2" id="logintype">
                    </div>
                    <div class="login-item">
                        <div class="login-item-name"></div>
                        <div class="login-item-ipt">

                        </div>
                    </div>

                    <div style="margin-top: 20px;">
                        <button class="btn btn-success btn-block" id="login-btn" >登&nbsp;&nbsp;录</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<script src="../admin/js/jquery.js"></script>
<script>
    $(function() {
        $("#login-btn").click(function () {
            var phone = $("#username").val()
            var password = $("#password").val()
            var logintype = $("#logintype").val();
            var token = localStorage.getItem("token");
            var head = new Headers();
            head.append('token', token);
            $.ajax({
                type: "post",
                url: "/hospital/api/user/login/password",
                data: {
                    "account": phone,
                    password: password,
                    logintype: logintype
                },
                dataType: "json",
                headers: {
                    'token': token
                },
                success: function (data, textStatus, request) {
                    if (data.code == 0) {
                        if (data.data == 4003) {
                            alert(data.msg)
                            localStorage.setItem("token", request.getResponseHeader("token"));
                            location.href = "home.html"
                        }
                    } else if (data.code == 1) {
                        alert(data.msg)
                    }
                }
            })

        })
    })
</script>

</html>